import {
  Injectable,
  InjectionToken,
  inject,
} from '@angular/core';
import { HelloService } from './hello.service';
import { AbsInfoService, IInfoService } from './interface';

export const INFO = new InjectionToken<IInfoService>(
  'info service token',
  {
    factory: () => new InfoService(inject(HelloService)),
  }
);

@Injectable()
export class InfoService
  extends AbsInfoService
  implements IInfoService
{
  constructor(private hello: HelloService) {
    console.log('----- Constructing InfoService ------');

    super();
  }

  inform() {
    // return this.info;
    // return 'This is InfoService.';
    return this.hello.sayHello();
  }
}
